package com.study.talk.data.local;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;

import com.study.talk.data.model.UserInfo;

import java.util.List;

/**
 * @author thor
 * @description:
 * @date 2024/12/31 10:58
 */
@Dao
public interface UserInfoDao {

    @Insert
    void insert(UserInfo userInfo);

    @Insert
    void insert(List<UserInfo> userInfos);

    @Delete
    void remove(UserInfo userInfo);

    @Delete
    void remove(List<UserInfo> userInfos);

    @Update
    void update(UserInfo userInfo);

    @Update
    void update(List<UserInfo> userInfos);

    @Query("SELECT * FROM user_info")
    List<UserInfo> query();

    @Query("SELECT * FROM user_info WHERE id=(:id)")
    UserInfo query(Integer id);

    @Query("SELECT COUNT(*) FROM user_info WHERE id=(:id)")
    Boolean has(Integer id);
}
